//
//  ST_QuickMessageTagItem.swift
//  btvideo
//
//  Created by mac on 2021/9/6.
//  Copyright © 2021 JarvanZhang. All rights reserved.
//

import UIKit

class ST_QuickMessageTagItem: UICollectionViewCell {
    
    /// 标签文字
    let titleLabel: UILabel = {
        let label = UILabel()
        label.text = "Label"
        label.textAlignment = .center
        label.textColor = .white
        label.font = .systemFont(ofSize: 15, weight: .semibold)
        return label
    }()
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        setup_views()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func draw(_ rect: CGRect) {
        cornerRadius = rect.height / 2
    }
    
    func setup_views() {
        
        contentView.addSubview(titleLabel)
        titleLabel.snp.makeConstraints { make in
            make.edges.equalToSuperview()
        }
    }
    
    func configure(for category: QuickMessageCategory, selectedCategory: QuickMessageCategory) {
        titleLabel.text = category.title
        backgroundColor = category == selectedCategory ? UIColor(hexString: "#FEC207") : UIColor.clear
        titleLabel.textColor = category == selectedCategory ? UIColor.white : UIColor(hexString: "#565656")
    }
}
